﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using wsn.dao;

namespace wsn
{
    public  static class Daofactory
    {
        //数据库基本类
        private static Message mes = new Message("localhost", "nash", "nash", "project");
        private static BaseDB DB=new BaseDB(mes);
        public static BaseDB db
        {
            get { return DB; }
            set { }
        }
        private static DataDao dataDao=new DataDao();
        private static SensorDao sensorDao=new SensorDao();
        private static SensorTypeDao typeDao = new SensorTypeDao();

        public static void loadData()
        {
            if (db.IsOpen == false)
                db.OpenDatabase();
            typeDao.loadTypes();
            sensorDao.loadSensors();
        }

        public static void storeData()
        {
            typeDao.storeTypes();
            sensorDao.storeSensors();
        }

        public static SensorDao getSensorDao() { return sensorDao; }

        public static DataDao getDataDao() { return dataDao; }

        public static SensorTypeDao getSensorTypeDao() { return typeDao; }

    }
}
